//
//  CarModel.swift
//  Car
//
//  Created by mac on 2017/10/30.
//  Copyright © 2017年 RRC. All rights reserved.
//

import Foundation

//汽车模型
public class CarModel{
    
    private var sequence = Array<String>()
    
    func start(){}
    func stop(){}
    func alarm(){}
    func engineBoom(){}
    func run(){
        for item in self.sequence {
            let actionName:String = item
            if(actionName == "start"){
                self.start()
            }else if actionName == "stop" {
                self.stop()
            }else if actionName == "alarm" {
                self.alarm()
            }else if actionName == "engine boom" {
                self.engineBoom()
            }
        }
    }
    func setSequence(sequence:Array<String>){
        self.sequence = sequence
    }
}


public class BenzModel: CarModel {
    
    override func alarm(){
        print("奔驰车的喇叭声音是这个样子的...")
    }
    
    override func engineBoom(){
        print("奔驰车的引擎是这个声音的...")
    }
    
    override func start() {
        print("奔驰车跑起来是这个样子的...")
    }
    
    override func stop() {
        print("奔驰车就该这样停车...")
    }
    
}

public class BMWModel: CarModel {
    
    override func alarm(){
        print("宝马车的喇叭声音是这个样子的...")
    }
    
    override func engineBoom(){
        print("宝马车的引擎是这个声音的...")
    }
    
    override func start() {
        print("宝马车跑起来是这个样子的...")
    }
    
    override func stop() {
        print("宝马车就该这样停车...")
    }
    
}

